<%-- 
    Document   : CadastroProfissao
    Created on : 18/05/2011, 19:45:03
    Author     : diogo
--%>

<%@include file="baseImports.jsp"%>
<%@page import="BancoDados.Area"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <%@include file="header.html"%>
	<%@include file="consultas/dadosUsuario.jsp"%>
    <tr>
        <td width="100%">
            <table width="850"  border="0" cellspacing="0" cellpadding="0">
                <tr>
					<%@include file="staticHtml/MenuEsquerdo.jsp"%>
                    <td   style="background-color:#edfaff;">
                        <table width="548"  border="0" cellspacing="0" >
                            <tr>
                                <td width="100%" style="padding:30px" align="left">
                                    <span class="title1">CADASTRO PROFISSAO</span><br>
<%
if (isAdmin){
%>												<br>
                                    <table  border="0" cellspacing="0" width="100%">
                                        <tr>
                                            <td valign="top" ><div align="justify">
                                                    <p><strong class="title2">Ag&ecirc;ncia G&oacute;is & G&oacute;is</strong><br>
                                                        <br>
													<%--=MenuEsquerdo.Gerar(new MenuEsquerdo("a", "s"), false)--%>
													<br/>
													<input type="hidden" id="filtro_tipo_area" name="filtro_tipo_area" value="combo"/>
													<%@include file="WEB-INF/consultas/ConsultaArea.jsp"%>
                                                    <fieldset>
														<!--
                                                        <form name="frm" action="UtilityServlet" onsubmit="return true"
                                                              method="get" onreset="">
															-->
                                                        <form name="frm" action="ServletProfissao" onsubmit="return true"
                                                              method="post">

                                                            <input type="hidden" name="tipo" value="inserir">

															<br/>

                                                            Selecione a &Aacute;rea da Profiss&atilde;o:
															
															<div id="output_area">
																<img src="<%=Sistema.Defs.LOADER_GIF%>" />
															</div>
															<br/> 
															

															Nome da Profiss&atilde;o: <br/>
                                                            <input type="text" name="Descricao" size="45" maxlength="60" value="<%%>">
                                                            <br><br>
															
                                                            <input Value="Cadastrar" class="buttonOK" type="submit" >
                                                            <input name="btnLimpar" class="buttonOK" type="reset" value="Limpar">

                                                        </form>
                                                    </fieldset>
															<%@include file="staticHtml/fancybox.html" %>
<script type="text/javascript">
	function initFancyboxConfig (){
		$("a.janela").fancybox({
			'width'				: '25%',
			'height'			: '35%',
			'autoScale'			: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe',
			onClosed	:	buscarProfissoes
		});
	}
	$(document).ready(initFancyboxConfig);
	function buscarProfissoes(){
		var sFiltro = document.getElementById("alterarProfFiltro").value;

		$.post('consultas/Profissao.jsp', {filtro_tipo_profissao: 'tabela', AreaCodArea: -1, Descricao: sFiltro},
			function(data){
				document.getElementById('output_profissao').innerHTML = data;
				initFancyboxConfig();
			}
		);
	}

	function deletarProfissao(CodProfissao, sNomeProfissao){
		var deletar = confirm('Realmente deletar profissao"'+ sNomeProfissao +'"?' )
		if (deletar){
			$.post('ServletProfissao', {tipo: 'deletar', CodProfissao : CodProfissao},
				function(data){
					if (data=="true"){
						buscarProfissoes();
					} else {
						alert('nao foi possivel deletar"' + sNomeProfissao + '",\nPois ja esta relacionado a algum profissional!')
					}
				}
			);
		}
	}


</script>
                                                    <fieldset>
														
														<legend> Alterar Profiss&otilde;es </legend>

														<input type="text" id="alterarProfFiltro" onkeydown="setTimeout(buscarProfissoes, 50)"/>
														<button onclick="buscarProfissoes()"> Consultar</button>
														<div id ="output_profissao">
															
														</div>
													</fieldset>

                                                    <p><br>
                                                    </p>
                                                </div>                                                          <div align="justify"></div></td>
                                        </tr>
                                    </table>

<%} else {%>
<%@include file="staticHtml/mensagens/erro_apenasAdmin.html" %>
<%} %>
                                    <br>
                                    <br>
                                    <br>
                                    <p>&nbsp;</p></td>
                            </tr>
                        </table>


                    </td>
                </tr>
            </table>
        </td>
    </tr>


